package com.jiexinyun.client;

import org.apache.commons.net.ftp.FTPClient;
import org.apache.commons.net.ftp.FTPFile;

public class FTPUtils {


    public static void goftp() throws Exception {
        FTPClient ftpClient = new FTPClient();
        try {
            ftpClient.connect("192.168.0.113");
            ftpClient.login("biaozhunjian", "biaozhunjian123!");

            // 操作示例
            ftpClient.changeWorkingDirectory("/path/to/directory");
            ftpClient.enterLocalPassiveMode();  // 被动模式
            FTPFile[] files = ftpClient.listFiles();

            ftpClient.logout();
        } finally {
            if (ftpClient.isConnected()) {
                ftpClient.disconnect();
            }
        }
    }

    public static void main(String[] args) {
        try {
            goftp();
        } catch (Exception e) {
            throw new RuntimeException(e);
        }
    }



}
